import React, { Component } from 'react';
import dynamic from 'dva/dynamic';
import { Route } from 'dva/router';

export default function loginRoute(app) {

  const Login = dynamic({
    app,
    models: () => {
      return [
        import(/* webpackChunkName: "loginModel" */'../models/login/loginModel'),
      ];
    },
    component: () => import(/* webpackChunkName: "login" */'../routes/login/login'),
  });
    const UserProtocol = dynamic({
        app,
        models: () => {
            return [
                import(/* webpackChunkName: "loginModel" */'../models/login/loginModel'),
            ];
        },
        component: () => import(/* webpackChunkName: "UserProtocol" */'../routes/login/userProtocol'),
    });

    const Reg = dynamic({
        app,
        models: () => {
            return [
                import(/* webpackChunkName: "loginModel" */'../models/login/loginModel'),
            ];
        },
        component: () => import(/* webpackChunkName: "reg" */'../routes/login/reg'),
    });
    const MemberPwd = dynamic({
        app,
        models: () => {
            return [
                import(/* webpackChunkName: "loginModel" */'../models/login/loginModel'),
            ];
        },
        component: () => import(/* webpackChunkName: "memberPwd" */'../routes/login/memberPwd'),
    });
    const PayPwd = dynamic({
        app,
        models: () => {
            return [
                import(/* webpackChunkName: "loginModel" */'../models/login/loginModel'),
            ];
        },
        component: () => import(/* webpackChunkName: "payPwd" */'../routes/login/payPwd'),
    });
    const ForgetPassword = dynamic({
        app,
        models: () => {
            return [
                import(/* webpackChunkName: "loginModel" */'../models/login/loginModel'),
            ];
        },
        component: () => import(/* webpackChunkName: "thirdParty" */'../routes/login/forgetPassword'),
    });
    const ThirdParty = dynamic({
        app,
        models: () => {
            return [
                import(/* webpackChunkName: "loginModel" */'../models/login/loginModel'),
            ];
        },
        component: () => import(/* webpackChunkName: "thirdParty" */'../routes/login/thirdParty'),
    });


  return (
    [
      <Route key="/login" exact path="/login" component={Login}/>,
      <Route key="/memberPwd" exact path="/memberPwd/:data/:Data" component={MemberPwd}/>,
      <Route key="/thirdParty" exact path="/thirdParty" component={ThirdParty}/>,
      <Route key="/userProtocol" exact path="/userProtocol" component={UserProtocol}/>,
      <Route key="/forgetPassword" exact path="/forgetPassword" component={ForgetPassword}/>,
      <Route key="/payPwd" exact path="/payPwd" component={PayPwd}/>,
      <Route key="/reg" exact path="/reg" component={Reg}/>,
    ]
  );
}
